import { left } from 'inquirer/lib/utils/readline';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';
import { colorList } from '/@/views/system/workflow/flowManagement/modules/flowPicture/modules/modules/nodeEdit/nodeEdit.data';

export const columns: BasicColumn[] = [
  {
    title: '标题',
    dataIndex: 'title',
    width: 400,
    align: 'left',
  },
  {
    title: '用户',
    dataIndex: 'toRealName',
    width: 100,
  },
  {
    title: '环节',
    dataIndex: 'actionTitle',
    width: 100,
    customRender: ({ record: { actionColorIndex, actionTitle } }) => {
      // 解构
      // let { currentActionColorIndex } = record;
      let color = 'blue';
      if (actionColorIndex != -1) {
        const it = colorList.find((item) => item.id == actionColorIndex);
        if (it) {
          color = it.color;
        }
      }
      return h(Tag, { color: color }, () => actionTitle || '- 无 -');
    },
  },
  {
    title: '抄送者',
    dataIndex: 'realName',
    width: 100,
  },
  // {
  //   title: '单位',
  //   dataIndex: 'unitName',
  //   width: 100,
  // },
  {
    title: '日期',
    dataIndex: 'disDate',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'title',
    label: '标题',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'dates',
    label: '日期',
    component: 'RangePicker',
    colProps: { span: 8 },
    componentProps: {
      style: 'width:100%',
    },
  },
];
